<?php

namespace App\Http\Middleware;

use Closure;

class Auth
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        if(Auth::guard()->guest() && !$this->shouldPassThrough($request)){

            if (Auth::guard()->guest()) {
                return redirect()->guest(admin_base_path('auth/login'));
            }

            return $next($request);
        }   
        return $next($request);
    }
}
